#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
int main(){
  int fd = open("./bite", O_RDWR | O_CREAT, 0664 );
  const char* msg="i like linux!\n";
  write(fd, msg, strlen(msg));

  lseek(fd, 0, SEEK_SET);//将读写位置放在文件的开头;

  char buffer[1024];
  ssize_t s = read(fd, buffer, sizeof(buffer) - 1);
  if(s > 0){
    buffer[s] = 0;
    printf("%s",buffer);
  }
  close(fd);

  return 0;
}
